﻿using System;

namespace diantou.web.onlineJudge
{
    /// <summary>
    /// 问题
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsReferer = false)]
    partial class questionCode : problemView<questionCode>
    {
        /// <summary>
        /// 是否验证问题权限
        /// </summary>
        protected override bool isShowPermission
        {
            get { return true; }
        }
        /// <summary>
        /// 是否基础问题
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        private bool isBaseGroup
        {
            get { return problem.IsBaseGroup; }
        }
        ///// <summary>
        ///// AC后发布到微博
        ///// </summary>
        //[fastCSharp.code.cSharp.webView.outputAjax]
        //private bool isMicroblog
        //{
        //    get
        //    {
        //        return currentUser != null && currentUser.IsMicroblog && !userProblem.IsAccepted;
        //    }
        //}
        /// <summary>
        /// OJ问题测试数据
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.dataAccess.problemTestData testData1;
        /// <summary>
        /// OJ问题测试数据
        /// </summary>
        private diantou.dataAccess.problemTestData TestData1
        {
            get
            {
                if (testData1 == null)
                {
                    testData1 = diantou.dataAccess.tcpCall.problemTestData.getTest1(problem.Id, 1 << 10);
                    if (testData1 == null) testData1 = diantou.dataAccess.problemTestData.NullData;
                }
                return testData1;
            }
        }
        /// <summary>
        /// 测试输入数据
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        private string TestDataInput
        {
            get { return TestData1.Input; }
        }
        /// <summary>
        /// 测试输出数据
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        private string TestDataOutput
        {
            get { return TestData1.Output; }
        }
        /// <summary>
        /// 是否正在提交代码
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        private bool isSubmit;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="problemId"></param>
        /// <returns></returns>
        protected override bool loadView(int problemId)
        {
            if (base.loadView(problemId))
            {
                if (problem.ShowType != dataModel.problem.showType.None) diantou.dataAccess.tcpCall.problem.browse(problemId, null);
                return true;
            }
            return false;
        }
    }
}
